package com.manli.api.controller.wechat;

import com.manli.api.base.annotation.Permissions;
import com.manli.api.dto.*;
import com.manli.api.enums.ResultEnums;
import com.manli.api.pojo.*;
import com.manli.api.service.AdvertisementService;
import com.manli.api.service.BuyCarLogService;
import com.manli.api.service.UserLinkUnionidService;
import com.manli.api.service.VisitWantToBuyLogService;
import com.manli.api.service.wechat.WechatShopService;
import com.manli.api.util.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@Api(tags = "商场活动接口")
@RequestMapping("api/wehcatshop/activity")
public class WechatShopActivityController {
    Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    AdvertisementService advertisementService;
    @Autowired
    WechatShopService wechatShopService;
    @Autowired
    BuyCarLogService buyCarLogService;
    @Autowired
    VisitWantToBuyLogService visitWantToBuyLogService;
    @Autowired
    UserLinkUnionidService userLinkUnionidService;
    @Autowired
    RedisTemplate redisTemplate;
    @Autowired
    SessionInfoUtils sessionInfoUtils;


    @ApiOperation(value = "一元拍卖列表接口",notes = "一元拍卖列表接口")
    @PostMapping("/oneYuanList")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result oneYuanList(@RequestBody QueryParams queryParams){
        return wechatShopService.oneYuanList(queryParams);
    }

    @ApiOperation(value = "一元拍卖商品详情",notes = "一元拍卖商品详情")
    @PostMapping("/oneYuanGoodsInfo")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result oneYuanGoodsInfo(@RequestBody QueryParamsOneYuan queryParams , HttpServletRequest request){
        return wechatShopService.oneYuanGoodsInfo(queryParams , request);
    }

    @ApiOperation(value = "一元拍卖商品竞价新增",notes = "一元拍卖商品竞价新增")
    @PostMapping("/oneYuanGoodsLogAdd")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result oneYuanGoodsLogAdd(@RequestBody ActivityLog activityLog,HttpServletRequest request){
        return wechatShopService.oneYuanGoodsLogAdd(activityLog,request);
    }

    @ApiOperation(value = "一元拍卖商品竞价日志列表",notes = "一元拍卖商品竞价日志列表")
    @PostMapping("/oneYuanGoodsLogList")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result oneYuanGoodsLogList(@RequestBody QueryParamsOneYuanLog queryParamsOneYuanLog){
        return wechatShopService.oneYuanGoodsLogList(queryParamsOneYuanLog);
    }

    @ApiOperation(value = "拼团砍价时间场次",notes = "拼团砍价时间场次")
    @PostMapping("/bargainingAndGroupTimes")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result bargainingAndGroupTimes(){
        return wechatShopService.bargainingAndGroupTimes();
    }

    @ApiOperation(value = "拼团砍价商品列表",notes = "拼团砍价商品列表")
    @PostMapping("/bargainingAndGroupGoodsList")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result bargainingAndGroupGoodsList(@RequestBody QueryParamsBargain queryParamsBargain){
        return wechatShopService.bargainingAndGroupGoodsList(queryParamsBargain);
    }

    @ApiOperation(value = "砍价单个商品详情页面",notes = "砍价单个商品详情页面")
    @PostMapping("/bargainingAndGroupGoodsInfo")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result bargainingAndGroupGoodsInfo(@RequestBody QueryParamsOneYuan queryParamsOneYuan){
        return wechatShopService.bargainingAndGroupGoodsInfo(queryParamsOneYuan);
    }

    @ApiOperation(value = "商品砍价页面详情",notes = "商品砍价页面详情")
    @PostMapping("/bargaining")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result bargaining(@RequestBody QueryParamsBargaining queryParamsBargaining,HttpServletRequest request){
        return wechatShopService.bargaining(queryParamsBargaining,request);
    }

    @ApiOperation(value = "砍价记录列表接口",notes = "砍价记录列表接口")
    @PostMapping("/bargainingList")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result bargainingList(@RequestBody QueryParamsBargain1 queryParamsBargain1,HttpServletRequest request){
        return wechatShopService.bargainingList(queryParamsBargain1,request);
    }

    @ApiOperation(value = "砍价记录新增接口",notes = "砍价记录新增接口")
    @PostMapping("/bargainingAdd")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result bargainingAdd(@RequestBody QueryParamsBargainAdd queryParamsBargainAdd,HttpServletRequest request){
        return wechatShopService.bargainingAdd(queryParamsBargainAdd,request);
    }

    @ApiOperation(value = "拼团单个商品详情页面",notes = "拼团单个商品详情页面")
    @PostMapping("/groupGoodsInfo")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result groupGoodsInfo(@RequestBody QueryParamsGroup1 queryParamsGroup, HttpServletRequest request){
        return wechatShopService.groupGoodsInfo(queryParamsGroup,request);
    }

    @ApiOperation(value = "自己或者分享的拼团详情",notes = "自己或者分享的拼团详情")
    @PostMapping("/selfGroupInfo")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_OPEN)
    public Result selfGroupInfo(@RequestBody QueryParamsGroup queryParamsGroup,HttpServletRequest request){
        return wechatShopService.selfGroupInfo(queryParamsGroup,request);
    }

    @ApiOperation(value = "推荐组团列表",notes = "推荐组团列表")
    @PostMapping("/recommendGroupInfo")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result recommendGroupInfo(@RequestBody QueryParamsGroupList queryParamsGroup){
        return wechatShopService.recommendGroupInfo(queryParamsGroup);
    }

    @ApiOperation(value = "拼团记录新增接口",notes = "拼团记录新增接口")
    @PostMapping("/groupAdd")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result groupAdd(@RequestBody QueryParamsBargainAdd queryParamsBargainAdd,HttpServletRequest request){
        return wechatShopService.groupAdd(queryParamsBargainAdd,request);
    }


}
